<?php
/**
 * Created by PhpStorm.
 * User: qilin
 * Date: 2017/9/27
 * Time: 10:47
 */
//创建Server对象，监听 127.0.0.1:9502端口，类型为SWOOLE_SOCK_UDP
$server = new swoole_http_server("0.0.0.0", 9503);
//监听数据接收事件
$server->on('Request',function ($request,$response){
    var_dump($request->get,$request->post);
    $response->header("Content-Type", "text/html; charset=utf-8");
    $response->end("<h1>Hello Swoole. #".rand(1000, 9999)."</h1>");
});

//启动服务器
$server->start();